<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录 - I投E行</title>
    <link href="favicon.ico" rel="icon">
    <link rel="stylesheet" href="css/style.css">
</head>
<body class="auth-page">
    <div class="auth-container">
        <div class="auth-card">
            <div class="auth-header">
                <h1>登录 I投E行</h1>
                <p>访问您的投资行为分析仪表盘</p>
            </div>
            <form id="loginForm" class="auth-form">
                <div class="form-group">
                    <label for="username">用户名或邮箱</label>
                    <input type="text" id="username" name="username" required>
                </div>
                <div class="form-group">
                    <label for="password">密码</label>
                    <input type="password" id="password" name="password" required>
                </div>
                <div class="form-options">
                    <label class="checkbox-container">
                        <input type="checkbox" id="rememberMe">
                        <span class="checkmark"></span>
                        记住我
                    </label>
                    <a href="#" class="forgot-password">忘记密码?</a>
                </div>
                <button type="submit" class="btn btn-primary btn-full">登录</button>
            </form>
            <div class="auth-footer">
                <p>还没有账户? <a href="register.html">立即注册</a></p>
            </div>

        </div>
    </div>

    <script src="js/main.js"></script>
    <script src="js/auth.js"></script>
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const loginForm = document.getElementById('loginForm');
            
            loginForm.addEventListener('submit', function(e) {
                e.preventDefault();
                
                const username = document.getElementById('username').value;
                const password = document.getElementById('password').value;
                
                const result = window.authManager.login(username, password);
                
                if (result.success) {
                    // 登录成功，跳转到仪表盘
                    window.location.href = 'dashboard.html';
                } else {
                    // 显示错误信息
                    alert(result.message);
                }
            });
        });
    </script>
</body>
</html>